const express = require('express');
const app = express();
const  fs = require('fs')
const port = 3000;

app.get('/img', (req, res) => {
   console.log(req.query);
   let data;
   if(req.query.callback == 'upload') {
       data = fs.readFileSync('./upload.js','utf-8')
       res.send(data)
   } else {
       res.send(data)
   }
});

app.get('/data', (req, res) => {
    const data = fs.readFileSync('./data.json','utf-8')
    res.send(data)
 });

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});
